package org.tellurium.builder

import org.tellurium.builder.UiObjectBuilder
import org.tellurium.object.SelectMenu

/**
 * Created by IntelliJ IDEA.
 * User: sesame.yangj
 * Date: 2009-8-27
 * Time: 11:20:09
 * To change this template use File | Settings | File Templates.
 */

public class SelectMenuBuilder extends UiObjectBuilder {
  static final String ITEMS = "items"
  static final String TITLE = "title"

  public Object build(Map map, Closure c) {
    def df = [:]
    df.put(TAG, SelectMenu.TAG)
    SelectMenu menu = this.internBuild(new SelectMenu(), map, df)
    Map<String, String> items = map.get(ITEMS);
    if (items != null && items.size() > 0) {
      menu.addMenuItems(items)
    }

    menu.addTitle(map.get(TITLE))
    return menu;
  }
}